package com.test.controllers;

import java.util.Arrays;

import android.app.Activity;
import android.content.Intent;
import android.content.SharedPreferences;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;

public class MainMenuActivity extends Activity {

	@SuppressWarnings("unused")
	private static final String TAG = "MainMenuActivity";
	public SharedPreferences preferencesImport;
	public String PREFS_NAME = "userPerferenceFile";
	
	
	ListView myList;

	String[] listContent = new String[] { "F1", "GP2", "GP3", "DTM" };
	String userName = "";
	String password = "";
	
	private void checkBundle()
	{
		Bundle extras = getIntent().getExtras();

		if (extras != null) {
			userName = extras.getString("username");
			password = extras.getString("password");
		}
		
	}
	
	
	/** Called when the activity is first created. */
	@Override
	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.mainmenu);

		checkBundle();

		
		//Get Preferences from Database
		//Populate array
	

		myList = (ListView) findViewById(R.id.listView1);

		Arrays.sort(listContent);

		ArrayAdapter<String> adapter

		= new ArrayAdapter<String>(this,

		android.R.layout.simple_list_item_1,

		listContent);

		myList.setAdapter(adapter);

		myList.setOnItemClickListener(new OnItemClickListener() {

			public void onItemClick(AdapterView<?> arg0, View arg1, int arg2,
					long arg3) {
				Intent intent = new Intent(MainMenuActivity.this,
						ProfileActivity.class);
				startActivity(intent);

			}

		});

		

	}

}
